﻿using System;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Web.Profile;

namespace WebSite.cn
{
    public partial class content : System.Web.UI.Page
    {
        // Fields

        public string classname = "";
        public string classnames = "";
        public string contents = "";
        public string leftmenu = "";

        // Methods
        private void Bind()
        {
            DataTable table = SQLAccess.GreatDs("select classname from DB_Class where classid=" + re.replace(base.Request.QueryString["cid"]) + "").Tables[0];
            if (table.Rows.Count > 0)
            {
                this.classname = table.Rows[0]["classname"].ToString();
            }
            DataTable table2 = SQLAccess.GreatDs("select classid,classname,parentid from DB_Class where parentid=" + re.replace(base.Request.QueryString["cid"]) + "").Tables[0];
            if (table2.Rows.Count > 0)
            {
                foreach (DataRow row in table2.Rows)
                {
                    string leftmenu = this.leftmenu;
                    this.leftmenu = leftmenu + "<li><a href=content.aspx?cid=" + row["parentid"].ToString() + "&cidd=" + row["classid"].ToString() + "  class='blue'>" + row["classname"].ToString() + "</a></li>";
                }
            }
            if (base.Request.QueryString["cidd"] != null)
            {
                this.contents = fun.menuinfo("", base.Request.QueryString["cidd"].ToString(), "2", "1");
                this.classnames = fun.menuinfo("", base.Request.QueryString["cidd"].ToString(), "1", "1");
            }
            else
            {
                this.contents = fun.menuinfo("", base.Request.QueryString["cid"].ToString(), "2", "1");
                this.classnames = fun.menuinfo("", base.Request.QueryString["cid"].ToString(), "1", "1");
            }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!base.IsPostBack && (base.Request.QueryString["cid"] != null))
            {
                this.Bind();
            }
        }



    }
}